public class Test {

    public static void main1(String[] args) {
        System.out.println(100 % 3);
        System.out.println(100 % 3.0);
        //受查异常/编译异常  非受查异常/运行异常
    }

    public static void main2(String[] args) {
        Person person1 = new Person("zhangsan", 32);
        try{
            Person person2 = (Person) person1.clone();
        }catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        System.out.println("fjwoeif");

    }

    public static void main3(String[] args) throws CloneNotSupportedException{
        Person person1 = new Person("zhangsan", 32);

        Person person2 = (Person) person1.clone();

        System.out.println(person1.name);
        System.out.println(person1.age);
        System.out.println(person1.money);
        person2.name = "lisi";
        person2.age = 12;
        person2.money.setM(44.3);


        System.out.println(person1.name);
        System.out.println(person1.age);
        System.out.println(person1.money);


    }


    public static void main11(String[] args) {
        try {
            int[] array = {1, 2, 3};
            getElement(array, 1);
            System.out.println(array[2]);
        } catch (NullPointerException e) {
            e.printStackTrace();
        } catch (ArrayIndexOutOfBoundsException e) {
            e.printStackTrace();
        }
        System.out.println("jeiwo");
    }

    public static void main(String[] args) {

        Login login = new Login("abc", "123");
        try {
            login.login("abce", "123");
        } catch (NameWrong e) {
            e.printStackTrace();
        } catch (NumsWrong e) {
            e.printStackTrace();
        }
    }

    public static int getElement(int[] array, int index) {
        if(null == array) {
            throw new NullPointerException("数组为null");
        }
        if(index < 0 || index >= array.length) {
            throw new ArrayIndexOutOfBoundsException("传递的数组下标越界");
        }
        return array[index];
    }
}


class Person implements Cloneable {
    String name;
    money money = new money(34.4);

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    int age;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person tmp = (Person)super.clone();
        tmp.money = (money) tmp.money.clone();
        return tmp;
    }
}

class money implements Cloneable{
    private double m;

    public money(double m) {
        this.m = m;
    }

    public double getM() {
        return m;
    }

    public void setM(double m) {
        this.m = m;
    }

    @Override
    public String toString() {
        return "money{" +
                "m=" + m +
                '}';
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}